<?php
/**
 * Created by PhpStorm.
 * User: lyh
 * Date: 2017/3/25
 * Time: 14:38
 */
function unlimitedForLayer ($cate, $name = 'child', $pid = 0) {
    $arr = array();
    foreach ($cate as $v) {
        if ($v['auth_pid'] == $pid) {
            $v[$name] = unlimitedForLayer($cate, $name, $v['auth_id']);
            $arr[] = $v;
        }
    }
    return $arr;
}